home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_imlib.idb / usr / freeware / include / Imlib_private.h.z / Imlib_private.h
Encoding:
C/C++ Source or Header  |  1999-07-21  |  4.6 KB  |  167 lines

  1. #ifndef CONVERT_PATH
  2. #define CONVERT_PATH "/usr/local/bin"
  3. #endif
  4.  
  5. #ifndef NETPBM_PATH
  6. #define NETPBM_PATH  "/usr/local/bin"
  7. #endif
  8.  
  9. #ifndef CJPEG_PROG
  10. #define CJPEG_PROG "/usr/local/bin/cjpeg"
  11. #endif
  12.  
  13. #ifndef DJPEG_PROG
  14. #define DJPEG_PROG "/usr/local/bin/djpeg"
  15. #endif
  16.  
  17. #include <stdio.h>
  18. #include <unistd.h>
  19. #include <stdlib.h>
  20. #include <math.h>
  21. #include <ctype.h>
  22. #include <time.h>
  23. #include <netinet/in.h>
  24. #ifdef HAVE_IPC_H
  25. #include <sys/ipc.h>
  26. #endif
  27. #ifdef HAVE_SHM_H
  28. #include <sys/shm.h>
  29. #endif
  30. #include <sys/time.h>
  31. #include <sys/types.h>
  32.  
  33. #ifdef _HAVE_STRING_H
  34. #include <string.h>
  35. #elif _HAVE_STRINGS_H
  36. #include <strings.h>
  37. #endif
  38.  
  39. #include <X11/Xlib.h>
  40. #include <X11/Xutil.h>
  41. #include <X11/Xatom.h>
  42. #include <X11/Xos.h>
  43. #ifdef HAVE_XSHM_H
  44. #include <X11/extensions/XShm.h>
  45. #endif
  46. #include <X11/extensions/shape.h>
  47. #include <X11/cursorfont.h>
  48.  
  49. #ifdef HAVE_LIBJPEG
  50. #include <jpeglib.h>
  51. #endif
  52. #ifdef HAVE_LIBPNG
  53. #include <png.h>
  54. #endif
  55. #ifdef HAVE_LIBTIFF
  56. #include <tiffio.h>
  57. #endif
  58. #ifdef HAVE_LIBGIF
  59. #include <gif_lib.h>
  60. #endif
  61.  
  62. #define BYTE_ORD_24_RGB 0
  63. #define BYTE_ORD_24_RBG 1
  64. #define BYTE_ORD_24_BRG 2
  65. #define BYTE_ORD_24_BGR 3
  66. #define BYTE_ORD_24_GRB 4
  67. #define BYTE_ORD_24_GBR 5
  68.  
  69. struct image_cache
  70.   {
  71.     char               *file;
  72.     ImlibImage         *im;
  73.     int                 refnum;
  74.     char                dirty;
  75.     struct image_cache *prev;
  76.     struct image_cache *next;
  77.   };
  78.  
  79. struct pixmap_cache
  80.   {
  81.     ImlibImage         *im;
  82.     char               *file;
  83.     char                dirty;
  84.     int                 width, height;
  85.     Pixmap              pmap;
  86.     Pixmap              shape_mask;
  87.     XImage             *xim;
  88.     XImage             *sxim;
  89.     int                 refnum;
  90.     struct pixmap_cache *prev;
  91.     struct pixmap_cache *next;
  92.   };
  93.  
  94.  
  95. int                 index_best_color_match(ImlibData * id, int *r, int *g, int *b);
  96. void                dirty_pixmaps(ImlibData * id, ImlibImage * im);
  97. void                dirty_images(ImlibData * id, ImlibImage * im);
  98. void                find_pixmap(ImlibData * id, ImlibImage * im, int width, int height, Pixmap * pmap, Pixmap * mask);
  99. ImlibImage         *find_image(ImlibData * id, char *file);
  100. void                free_pixmappmap(ImlibData * id, Pixmap pmap);
  101. void                free_image(ImlibData * id, ImlibImage * im);
  102. void                flush_image(ImlibData * id, ImlibImage * im);
  103. void                add_image(ImlibData * id, ImlibImage * im, char *file);
  104. void                add_pixmap(ImlibData * id, ImlibImage * im, int width, int height, XImage * xim, XImage * sxim);
  105. void                clean_caches(ImlibData * id);
  106. void                nullify_image(ImlibData * id, ImlibImage * im);
  107.  
  108. char               *_GetExtension(char *file);
  109.  
  110. #ifdef HAVE_LIBJPEG
  111. unsigned char      *_LoadJPEG(ImlibData * id, FILE * f, int *w, int *h);
  112.  
  113. #endif /* HAVE_LIBJPEG */
  114. #ifdef HAVE_LIBPNG
  115. unsigned char      *_LoadPNG(ImlibData * id, FILE * f, int *w, int *h, int *t);
  116.  
  117. #endif /* HAVE_LIBPNG */
  118. #ifdef HAVE_LIBTIFF
  119. unsigned char      *_LoadTIFF(ImlibData * id, FILE *f, char *file, int *w, int *h, int *t);
  120.  
  121. #endif /* HAVE_LIBTIFF */
  122. #ifdef HAVE_LIBGIF
  123. unsigned char      *_LoadGIF(ImlibData * id, FILE *f, int *w, int *h, int *t);
  124.  
  125. #endif /* HAVE_LIBGIF */
  126. unsigned char      *_LoadBMP(ImlibData * id, FILE *f, int *w, int *h, int *t);
  127. unsigned char      *_LoadXPM(ImlibData * id, FILE *f, int *w, int *h, int *t);
  128. unsigned char      *_LoadPPM(ImlibData * id, FILE * f, int *w, int *h);
  129. int                 ispnm(FILE *f);
  130. int                 isjpeg(FILE *f);
  131. int                 ispng(FILE *f);
  132. int                 istiff(FILE *f);
  133. int                 iseim(FILE *f);
  134. int                 isgif(FILE *f);
  135. int                 isxpm(FILE *f);
  136. int                 isbmp(FILE *f);
  137.  
  138. void                calc_map_tables(ImlibData * id, ImlibImage * im);
  139.  
  140. void                _PaletteAlloc(ImlibData * id, int num, int *cols);
  141.  
  142. FILE               *open_helper(const char *, const char *, const char *);
  143. int                 close_helper(FILE *);
  144.  
  145. #define INDEX_RGB(r,g,b)  id->fast_rgb[(r<<10)|(g<<5)|(b)]
  146. #define COLOR_INDEX(i)    id->palette[i].pixel
  147. #define COLOR_RGB(r,g,b)  id->palette[INDEX_RGB(r,g,b)].pixel
  148. #define ERROR_RED(rr,i)   rr-id->palette[i].r;
  149. #define ERROR_GRN(gg,i)   gg-id->palette[i].g;
  150. #define ERROR_BLU(bb,i)   bb-id->palette[i].b;
  151.  
  152. #define DITHER_ERROR(Der1,Der2,Dex,Der,Deg,Deb) \
  153. ter=&(Der1[Dex]);\
  154. (*ter)+=(Der*7)>>4;ter++;\
  155. (*ter)+=(Deg*7)>>4;ter++;\
  156. (*ter)+=(Deb*7)>>4;\
  157. ter=&(Der2[Dex-6]);\
  158. (*ter)+=(Der*3)>>4;ter++;\
  159. (*ter)+=(Deg*3)>>4;ter++;\
  160. (*ter)+=(Deb*3)>>4;ter++;\
  161. (*ter)+=(Der*5)>>4;ter++;\
  162. (*ter)+=(Deg*5)>>4;ter++;\
  163. (*ter)+=(Deb*5)>>4;ter++;\
  164. (*ter)+=Der>>4;ter++;\
  165. (*ter)+=Deg>>4;ter++;\
  166. (*ter)+=Deb>>4;
  167.